package com.example.demo.endpoint;


import com.example.demo.core.annotation.Endpoint;
import com.example.demo.core.annotation.Mapping;
import com.example.demo.serivce.impl.RegisterRequestHandler;
import com.example.demo.serivce.impl.message.notify.KeepaliveRequestHandler;
import gov.nist.javax.sip.RequestEventExt;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import javax.sip.*;
import javax.sip.message.MessageFactory;
import javax.sip.message.Request;
import javax.sip.message.Response;
import java.text.ParseException;

import static com.example.demo.core.handlerMapping.interfaces.GB28181.*;

@Endpoint
@Component
public class gbEndpoint {
    @Resource
    RegisterRequestHandler registerRequestHandler;
    @Resource
    KeepaliveRequestHandler keepaliveRequestHandler;

    @Mapping(types = 注册, desc = "注册")
    public Response Register(RequestEvent requestEvent) throws ParseException, SipException {
        return registerRequestHandler.Register(requestEvent);
    }

    @Mapping(types = 心跳, desc = "心跳保活")
    public Response Keepalive(RequestEvent requestEvent) throws PeerUnavailableException, ParseException {
       return keepaliveRequestHandler.Keepalive(requestEvent);

    }
    @Mapping(types = 查询目录, desc = "心跳保活")
    public Response DeviceInfo(RequestEvent requestEvent) throws PeerUnavailableException, ParseException {
        Request request = requestEvent.getRequest();
        return keepaliveRequestHandler.Keepalive(requestEvent);

    }




}
